/*
    *******************************
    post请求处理的实现部分
    *******************************
*/

#include "postProcessor.h"

postProcesssor::postProcesssor() {
    this->method = llhttp_method::HTTP_POST;
    this->KeepAlive = false;
}

postProcesssor::~postProcesssor() = default;

void postProcesssor::setClientSockfd(int newFd) {
    this->ClientSockfd = newFd;
}

void postProcesssor::setMessageBody(const std::string& body) {
    // json解析 
    if (!this->jsonReader.parse(body, this->messageBody, false)) {
        logger->error("[POST] json数据解析失败:{}({})", __FILE__, __LINE__);
        throw std::runtime_error("[POST] 设置body失败");
    }
    logger->info("来了一个json!");
    spdlog::info("来了一个json!");
}

llhttp_method postProcesssor::getMethod() {
    return this->method;
}

void postProcesssor::run() {
    
}